<!-- 分页的标记页面 -->
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="/common/jsp/taglibs-nojs-nocss.jsp"%>
<%
	String pathPage = request.getContextPath();
	String basePathPage = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ pathPage + "/";
%>
<div id="pagination_box">
	<!-- 当前总页数大于0 -->
	<s:if test="page.totalPage>0">
		<ul id="pagination">
			<!-- 如果当前页为第一页，那此上一页不可用 -->
			<s:if test="page.pageNo==1">
				<li class="nolink">&laquo; 上一页</li>
			</s:if>
			<s:else>
				<li onclick="gotoPage(<s:property value="page.pageNo-1"/> , <s:property value="page.totalPage"/> , <s:property value="page.pageSize"/>);return false;"><a  href="javascript:;">&laquo; 上一页</a></li>
			</s:else>
			<!-- 如果当前页数大于5就要把头与尾始终显示 -->
			<s:if test="page.totalPage>5">
				<!-- 始终显示头 -->
				<!-- 如果当前页为第一页 -->
				<s:if test="page.pageNo==1">
					<li class="current"><a href="javascript:;" onclick="gotoPage(1,<s:property value="page.totalPage"/>,<s:property value="page.pageSize"/>);return false;">1</a></li>
					<li><a href="javascript:;" onclick="gotoPage(<s:property value="page.pageNo+1"/> , <s:property value="page.totalPage"/> , <s:property value="page.pageSize"/>);return false;"><s:property value="page.pageNo+1"/></a></li>
					<li><a href="javascript:;" onclick="gotoPage(<s:property value="page.pageNo+2"/> , <s:property value="page.totalPage"/> , <s:property value="page.pageSize"/>);return false;"><s:property value="page.pageNo+2"/></a></li>
				</s:if>
				<s:else>
					<li><a href="javascript:;" onclick="gotoPage(1 , <s:property value="page.totalPage"/> , <s:property value="page.pageSize"/>);return false;">1</a></li>
				</s:else>
				<!-- 省略号 -->
				<s:if test="page.pageNo>3">
					<li>...</li>
				</s:if>
				<s:if test="page.pageNo!=1 && page.pageNo!=page.totalPage">
					 <s:if test="page.pageNo!=2">
					 	<li><a href="javascript:;" onclick="gotoPage(<s:property value="page.pageNo-1"/> , <s:property value="page.totalPage"/> , <s:property value="page.pageSize"/>);return false;"><s:property value="page.pageNo-1"/></a></li>
					 </s:if>
					 <li class="current"><a href="javascript:;" onclick="gotoPage(<s:property value="page.pageNo"/> , <s:property value="page.totalPage"/> , <s:property value="page.pageSize"/>);return false;"><s:property value="page.pageNo"/></a></li>
					 <s:if test="page.pageNo != page.totalPage-1">
					 	<li><a href="javascript:;" onclick="gotoPage(<s:property value="page.pageNo+1"/> , <s:property value="page.totalPage"/> , <s:property value="page.pageSize"/>);return false;"><s:property value="page.pageNo+1"/></a></li>
					 </s:if>
					 <s:if  test="page.pageNo==2">
					 	<li><a href="javascript:;" onclick="gotoPage(<s:property value="page.pageNo+2"/> , <s:property value="page.totalPage"/> , <s:property value="page.pageSize"/>);return false;"><s:property value="page.pageNo+2"/></a></li>
					 </s:if>
				</s:if>
				<!-- 省略号 -->
				<s:if test="page.pageNo<page.totalPage-2">
					<li>...</li>
				</s:if>
				<!-- 始终显示最后一页 -->
				<!-- 如果当前页为最后一页 -->
				<s:if test="page.pageNo==page.totalPage">
					<li><a href="javascript:;" onclick="gotoPage(<s:property value="page.pageNo-2"/> , <s:property value="page.totalPage"/> , <s:property value="page.pageSize"/>);return false;"><s:property value="page.pageNo-2"/></a></li>
					<li><a href="javascript:;" onclick="gotoPage(<s:property value="page.pageNo-1"/> , <s:property value="page.totalPage"/> , <s:property value="page.pageSize"/>);return false;"><s:property value="page.pageNo-1"/></a></li>
					<li class="current"><a href="javascript:;" onclick="gotoPage(<s:property value="page.totalPage"/> , <s:property value="page.totalPage"/> , <s:property value="page.pageSize"/>);return false;"><s:property value="page.totalPage"/></a></li>
				</s:if>
				<s:else>
					<li><a href="javascript:;" onclick="gotoPage(<s:property value="page.totalPage"/> , <s:property value="page.totalPage"/> , <s:property value="page.pageSize"/>);return false;"><s:property value="page.totalPage"/></a></li>
				</s:else>
			</s:if>
			<!-- 如果总页数小于5页时 -->
			<s:else>
				<s:set name="count" value="page.totalPage"></s:set>
				<s:set name="current" value="page.pageNo"></s:set>
				<%
				int cou = Integer.parseInt( null == request.getAttribute("count") ? "0" : request.getAttribute("count").toString() );
				int current = Integer.parseInt( null == request.getAttribute("current") ? "0" : request.getAttribute("current").toString() );
				for( int i=1;i<=cou;i++ ){
					if( i==current ){
						%><li class="current"><a href="javascript:;" onclick="gotoPage(<%=i %>  , <s:property value="page.totalPage"/> , <s:property value="page.pageSize"/> );return false;"><%=i %></a></li><%
					}else{
						%><li><a href="javascript:;" onclick="gotoPage(<%=i %> , <s:property value="page.totalPage"/> , <s:property value="page.pageSize"/>);return false;"><%=i %></a></li><%
					}
				}
				 %>
			</s:else>
			<!-- 如果是最后一页，那么下一页不可用 -->
			<s:if test="page.pageNo==page.totalPage">
				<li class="nolink">下一页 &raquo;</li>
			</s:if><s:else>
				<li onclick="gotoPage(<s:property value="page.pageNo+1"/> , <s:property value="page.totalPage"/> , <s:property value="page.pageSize"/>);return false;"><a  href="javascript:;">下一页&raquo;</a> </li>
			</s:else>
			<li style=" padding-left:5px;">
				到<input class="page_input" type="text" value="" />页<button type="button" class="page_btn" onclick="gotoPage( _getPrevious(this).value  , <s:property value="page.totalPage"/> , <s:property value="page.pageSize"/>);return false;">确定</button>
			</li>
			<li style="margin-top:4px;">
				<label>每页记录数<s:property value="page.pageSize"/></label>
			</li>
		</ul>
	</s:if>
</div>